import { Inject, Controller, Provide, Get } from '@midwayjs/decorator'
import { Context } from '@midwayjs/koa'
import { IApiService, IApiDetailService } from '../interface'

@Provide()
@Controller('/api')
export class Api {
  @Inject()
  ctx: Context

  @Inject('ApiService')
  service: IApiService

  @Inject('ApiDetailService')
  detailService: IApiDetailService

  @Get('/index')
  async getIndexData () {
    const data = await this.service.index()
    return data
  }

  @Get('/detail/:id')
  async getDetailData () {
    const { ctx, detailService } = this
    const id = ctx.params.id
    const data = await detailService.index(id)
    return data
  }

  @Get('/university')
  async getUniversity () {
    return 1
  }

  @Get('/universityDetail/:id')
  async getuniversityDetailData () {
    const { ctx, detailService } = this
    const id = ctx.params.id
    const data = await detailService.index(id)
    return data
  }

  @Get('/major')
  async getMajorData () {
    const { ctx, detailService } = this
    const id = ctx.params.id
    const data = await detailService.index(id)
    return data
  }

  @Get('/rank')
  async getRankData () {
    const { ctx, detailService } = this
    const id = ctx.params.id
    const data = await detailService.index(id)
    return data
  }

  
  @Get('/news')
  async getNewsData () {
    const { ctx, detailService } = this
    const id = ctx.params.id
    const data = await detailService.index(id)
    return data
  }

  @Get('/news/newsList')
  async getNewsListData () {
    const { ctx, detailService } = this
    const id = ctx.params.id
    const data = await detailService.index(id)
    return data
  }

  @Get('/news/newsDetail/:id')
  async getNewsDetailData () {
    const { ctx, detailService } = this
    const id = ctx.params.id
    const data = await detailService.index(id)
    return data
  }

  @Get('/universityGradeLink')
  async getUniversityGradeLink () {
    return 1
  }
  @Get('/universityCompare')
  async getUniversityCompare () {
    return 1
  }
  @Get('/user')
  async getUser () {
    return 1
  }
  @Get('/rankSearchUniversity')
  async getRankSearchUniversity () {
    return 1
  }
  @Get('/line')
  async getLine () {
    return 1
  }
  @Get('/admissionBrochure')
  async getAdmissionBrochure () {
    return 1
  }
  @Get('/lineSelectUniversity')
  async getLineSelectUniversity () {
    return 1
  }
  @Get('/admissionProbability')
  async getAdmissionProbability () {
    return 1
  }
  @Get('/volunteer')
  async getVolunteer () {
    return 1
  }
}
